package com.changgou.system.search.listener;


import com.changgou.system.search.config.RabbitMQConfig;
import com.changgou.system.search.service.EsManagerService;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/*** 商品添加索引库消息监听类 */
@Component
public class GoodsUpListener {

    @Autowired
    private EsManagerService esManagerService;
    //监听某个队列
    @RabbitListener(queues = RabbitMQConfig.SEARCH_ADD_QUEUE)
    public void searchAdd(String spuId) {
        System.out.println("接收到消息："+spuId);
        //查询相应数据，入es库
        esManagerService.importDataToESBySpuId(spuId);
    }

}

